import sys
data = sys.stdin.readlines()
#data = ["5 7", "1 3", "1 2", "2 4", "1 5" , "2 3", "3 4","4 3"]
#data = ["5 5", "1 2", "2 4", "2 3", "3 4","4 5"]

def read_data():
    str_total = data[0]
    result = []
    ncount = int(str_total)
    count = 0;
    for strin in data[1:]:
        ps1, ps2 = strin.split(" ");
        p1 = int(ps1)
        p2 = int(ps2)
        result.append((p1,p2))
        count = count + 1
        if(count == ncount): break;
    return result

def distance(p1, p2):
    xdiff = abs(p1[0] - p2[0])
    ydiff = abs(p1[1] - p2[1])
    return min(xdiff, ydiff) + abs(xdiff - ydiff) // 1

def find_median_cells(all_points):
    avgx = 0
    avgy = 0
    size_pts = len(all_points)
    for pt in all_points:
        avgx = avgx + pt[0]
        avgy = avgy + pt[1]
    avgx = avgx / size_pts
    avgy = avgy / size_pts
    dists = []
    pos = 0;
    for pt in all_points:
        dist = distance(pt, (avgx, avgy))
        dists.append((dist, pos))
        pos = pos + 1
    
    dists.sort(key=lambda dist: dist[0])
    ret = []
    candidates = min(33, size_pts)
    for i in range(candidates):
        ret.append(all_points[dists[i][1]])
    return ret


def calculate_total_distance(all_points, candidate):
    total_dist = 0
    for pt in all_points:
        dist = distance(pt, candidate)
        total_dist = total_dist + dist
    return total_dist

all_pts = read_data()
candidates = find_median_cells(all_pts)

min_dis = calculate_total_distance(all_pts, candidates[0]);
for candidate in candidates[1:]:
    total = calculate_total_distance(all_pts, candidate)
    if total < min_dis:
        min_dis = total
print(min_dis)

